define(["angular"], function (angular) {
    var hostName = window.document.location.hostname;
    var commonModule = angular.module("commonModule", []);
    commonModule.service("API_URL", function () {
        return {
            "USER_SERVER": "http://" + hostName + ":8060"
        }
    });

    commonModule.service("COOKIES", function () {
        return {
            setCookie: function (key, value) {
                var Days = 30;
                var exp = new Date();
                exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
                document.cookie = key + "=" + value + ";expires=" + exp.toGMTString();
            },
            getCookie: function (key) {
                var arr, reg = new RegExp("(^| )" + key + "=([^;]*)(;|$)");

                if (arr = document.cookie.match(reg))

                    return unescape(arr[2]);
                else
                    return null;
            },
            delCookie: function (name) {
                var exp = new Date();
                exp.setTime(exp.getTime() - 1);
                var cval = this.getCookie(name);
                if (cval != null)
                    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
            }
        }
    })

    commonModule.service("Authentication", function () {
        return {
            getUser: function (user) {
                return false;
            }
        }
    })
    return commonModule;
})